package com.pktechan.manage.activeMq;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.jms.annotation.JmsListener;
import org.springframework.stereotype.Component;

/**
 * @program: cloudfloating
 * @description: 发送小程序topic
 * @author: qx.zhang
 * @create: 2021-03-12 16:54
 **/
@Component
public class TopicSendMiniMessageListener {
    private Logger logger = LoggerFactory.getLogger(this.getClass());

    //topic模式的消费者
//    @JmsListener(destination = "${activemq.cloud-floating-send-mini-message-topic-name}", containerFactory = "topicListener")
    public void receiveSendMiniMessageTopic(String message) {
        logger.debug("receiveSendMiniMessageTopic接收到消息：" + message);
//        try {
//            //MQ消息内容
//            logger.debug("receiveSendMiniMessageTopic接收到消息：" + message);
//            BaseMessage baseMessage = JSONObject.parseObject(message, BaseMessage.class);
//            //根据消息类型查询发送指定类型消息的对象
//            SendMiniMessageStrategy sendMiniMessageStrategy = BaseSendMiniMessage.getSendMiniMessage(SendMiniMessageEnum.getSendMiniMessageEnumByCode(baseMessage.getMessageType()));
//            sendMiniMessageStrategy.sendMiniMessage(message);
//        } catch (Exception e) {
//            e.printStackTrace();
//            logger.info("ActiveMQSendMsgReceiver微信消息发送失败");
//        }
    }
}
